//
//  FindTableViewCell.m
//  XWZ_News_Work
//
//  Created by penngshi on 16/1/12.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "FindTableViewCell.h"

@implementation FindTableViewCell
- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubViews];
    }
    
    return self;
}

- (void)createSubViews {
    
#pragma mark - 大图片
    self.bigImageV = [[UIImageView alloc] init];
//    self.bigImageV.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.bigImageV];
    [self.bigImageV mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.contentView.mas_left);
        make.top.equalTo(self.contentView.mas_top);
        make.width.equalTo(self.contentView.mas_width);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.571 * SIZE);
    }];
    
#pragma mark - 头像
    self.headImageV = [[UIImageView alloc] init];
    //    self.headImageV.backgroundColor = [UIColor blackColor];
    self.headImageV.layer.masksToBounds = YES;//裁掉边界
    self.headImageV.layer.cornerRadius = 25;//设置半径
    [self.bigImageV addSubview:self.headImageV];
    [self.headImageV mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.bigImageV.mas_left).offset(20 * SIZE);
        make.top.equalTo(self.bigImageV.mas_top).offset(130 * SIZE);
        make.size.mas_equalTo(CGSizeMake(50, 50));
        //        make.width.equalTo(self.bigImageV.mas_width).multipliedBy(0.13 * SIZE);
        //        make.height.equalTo(self.bigImageV.mas_height).multipliedBy(0.25 * SIZE);
    }];
    
#pragma mark - 名字
    self.nameLable = [[UILabel alloc] init];
    //    self.nameLable.backgroundColor = [UIColor blackColor];
    self.nameLable.textColor = [UIColor whiteColor];
    [self.bigImageV addSubview:self.nameLable];
    [self.nameLable mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.bigImageV.mas_left).offset(80 * SIZE);
        make.top.equalTo(self.bigImageV.mas_top).offset(140 * SIZE);
        make.width.equalTo(self.bigImageV.mas_width).multipliedBy(0.5 * SIZE);
        make.height.equalTo(self.bigImageV.mas_height).multipliedBy(0.15 * SIZE);
    }];
    
#pragma mark - 介绍
    self.aliasLabel = [[UILabel alloc] init];
    //    self.aliasLabel.backgroundColor = [UIColor blackColor];
    self.aliasLabel.font = [UIFont systemFontOfSize:18 * SIZE];
    [self.contentView addSubview:self.aliasLabel];
    self.aliasLabel.numberOfLines = 0;
    [self.aliasLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.contentView.mas_left).offset(20 * SIZE);
        make.top.equalTo(self.contentView.mas_top).offset(205 * SIZE);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.893 * SIZE);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.23 * SIZE);
        
    }];
    
#pragma mark - 关注数量
    self.countLabel = [[UILabel alloc] init];
    //    self.countLabel.backgroundColor = [UIColor blackColor];
    self.countLabel.textColor = [UIColor colorWithWhite:0.563 alpha:1.000];
    self.countLabel.font = [UIFont systemFontOfSize:14 * SIZE];
    [self.contentView addSubview:self.countLabel];
    [self.countLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.contentView.mas_left).offset(20 * SIZE);
        make.top.equalTo(self.contentView.mas_top).offset(310 * SIZE);
        make.width.equalTo(self.contentView.mas_width).multipliedBy(0.18 * SIZE);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.05 * SIZE);
        
    }];
    
#pragma mark - 竖线
    self.shuView = [[UIView alloc] init];
    self.shuView.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:self.shuView];
    [self.shuView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.countLabel.mas_left).offset(375 * 0.18 * SIZE + 2 * SIZE);
        make.top.equalTo(self.countLabel.mas_top).offset(3 * SIZE);
        make.width.equalTo(self.countLabel.mas_width).multipliedBy(0.005 * SIZE);
        make.height.equalTo(self.countLabel.mas_height).multipliedBy(0.7 * SIZE);
        
    }];
    
#pragma mark - 种类 (例如:教育..)
    self.kindLabel = [[UILabel alloc] init];
    //    self.kindLabel.backgroundColor = [UIColor blackColor];
    self.kindLabel.textColor = [UIColor colorWithRed:0.267 green:0.478 blue:0.702 alpha:1.000];
    self.kindLabel.font = [UIFont systemFontOfSize:14 * SIZE];
    [self.contentView addSubview:self.kindLabel];
    [self.kindLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.countLabel.mas_left).offset(375 * 0.20 * SIZE + 5 * SIZE);
        make.top.equalTo(self.countLabel.mas_top);
        make.width.equalTo(self.countLabel.mas_width);
        make.height.equalTo(self.countLabel.mas_height);
        
    }];
    
    
}

-(void)setFindModel:(FinfModel *)findModel {
    
    _findModel = findModel;
    
    [self.bigImageV sd_setImageWithURLStr:self.findModel.picurl placeholderImage:[UIImage imageNamed:@"lol-tupian"]];
    [self.headImageV sd_setImageWithURLStr:self.findModel.headpicurl placeholderImage:[UIImage imageNamed:@"lol-tupian"]];
    self.nameLable.text = self.findModel.name;
    self.aliasLabel.text = self.findModel.alias;
    NSString *str = self.findModel.concernCount;
    self.countLabel.text = [NSString stringWithFormat:@"%@ 关注",str];
    self.kindLabel.text = self.findModel.classification;
    
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
